package cn.rkylin.oms.aftersale.sysreturn.service;

import cn.rkylin.oms.aftersale.sysreturn.domain.SysReturnSku;
import cn.rkylin.oms.aftersale.sysreturn.vo.ReturnInfoVO;
import cn.rkylin.oms.aftersale.sysreturn.vo.SysReturnVO;
import cn.rkylin.oms.order.vo.OrderSkuVO;
import com.github.pagehelper.PageInfo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ISysReturnService {
    /**
     * querySysReturnVOList:根据查询条件获取退货单列表. <br/>
     *
     * @param sysReturn
     * @return
     * @throws Exception
     * @author zhanghao
     */
    List<SysReturnVO> querySysReturnVOList(SysReturnVO sysReturn) throws Exception;

    /**
     * generateReturn:生成退货单及其明细. <br/>
     *
     * @param sysReturn
     * @throws Exception
     * @author zhanghao
     */
    int generateReturn(SysReturnVO sysReturn) throws Exception;

    /**
     * updateSysReturn:更新退货单信息. <br/>
     *
     * @param param
     * @throws Exception
     * @author zhanghao
     */
    int updateSysReturn(SysReturnVO param) throws Exception;

    /**
     * updateSysReturn4local:废弃三方仓退货单. <br/>
     *
     * @param param
     * @throws Exception
     * @author zhanghao
     */
    int cancelSysReturn4Ext(SysReturnVO param) throws Exception;

    /**
     * cancelSysReturn4local:废弃本地仓退货单. <br/>
     *
     * @param param
     * @throws Exception
     * @author zhanghao
     */
    int cancelSysReturn4Local(SysReturnVO param) throws Exception;

    /**
     * deleteReturnSkuByAutoReturnId:根据退货单ID删除退货单明细. <br/>
     *
     * @param returnId
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int deleteReturnSkuByAutoReturnId(String returnId) throws Exception;

    /**
     * updateUnApproveSysReturn:将特定退货单状态设置为未审核. <br/>
     *
     * @param param
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int updateUnApproveSysReturn(SysReturnVO param) throws Exception;

    /**
     * querySysReturnVOListWithExtend 根据查询条件获取退货单列表
     *
     * @param queryParam
     * @return
     * @throws Exception
     * @author zhanghao
     */
    List<SysReturnVO> querySysReturnVOListWithExtend(SysReturnVO queryParam) throws Exception;

    /**
     * 按条件查询退货单信息列表(分页)
     *
     * @param page
     * @param length
     * @param queryParamVO
     * @return
     * @throws Exception
     */
    public PageInfo<SysReturnVO> getSysReturnListByCondition(int page, int length, SysReturnVO queryParamVO) throws Exception;

    /**
     * 通过ID获取单条退货单信息
     *
     * @param returnId
     * @return
     * @throws Exception
     */
    public SysReturnVO selectByPrimaryKey(String returnId) throws Exception;

    /**
     * generateReturnSysByRefund:根据一个退款单ID生成退货单. <br/>
     *
     * @param sysRefundId
     * @author zhanghao
     */
    void generateReturnSysByRefund(String sysRefundId) throws Exception;

    /**
     * 获取退货单各个Tab页单据数量
     *
     * @param queryParamVO
     * @return
     * @throws Exception
     */
    public List<HashMap> findStateCount(SysReturnVO queryParamVO) throws Exception;

    /**
     * 通过ID获取单条退货单信息
     *
     * @param returnId
     * @return
     * @throws Exception
     */
    public SysReturnVO selectByPrimaryKeyOnly(String returnId) throws Exception;

    /**
     * 保存系统退货单
     *
     * @param returnInfoVO * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> saveSysReturns(ReturnInfoVO returnInfoVO, Map<String, String> map) throws Exception;

    /**
     * 删除系统退货单
     *
     * @param returnIds
     * @return
     * @throws Exception
     */
    public int deleteSysReturn(String returnIds) throws Exception;

    /**
     * 审核系统退货单校验，并可返回错误信息
     * 校验：退货快递单号和退回物流公司不能为空
     *
     * @param sysReturnId
     * @return
     * @throws Exception
     */
    public String apprSysReturnCheck(String sysReturnId) throws Exception;

    /**
     * 审核系统退货单，并可返回错误信息
     *
     * @param sysReturnId
     * @return
     * @throws Exception
     */
    public String apprSysReturn(String sysReturnId, String prjShortName, String sysReturnCodes) throws Exception;

    /**
     * 取消系统退货单，并可返回错误信息
     *
     * @param sysReturnId
     * @return
     * @throws Exception
     */
    public String cancelSysReturn(String sysReturnId) throws Exception;

    /**
     * 通过系统退货单ID获取退货单商品信息
     *
     * @param returnId
     * @param orderId
     * @return
     * @throws Exception
     */
    public List<OrderSkuVO> selectByReturnId(String returnId, String orderId) throws Exception;
    
    public List<SysReturnVO> findSysReturnByOrderId(String orderId) throws Exception;
    
    public List<SysReturnSku> findSysReturnSkuByReturnSkuId(String returnSkuId) throws Exception;

    int getUnGoingCount(Map<String, String> paramMap) throws Exception;
    
    SysReturnSku selectSysReturnSkuByPrimaryKey(String returnSkuId) throws Exception;

    /**
     * getPlanSnCodeByReturnSku:根据计划退货商品获取计划退货sn号. <br/>
     *
     * @author zhanghao
     * @param sysReturnSku
     * @param returnValue
     * @return
     * @throws Exception
     */
    String getPlanSnCodeByReturnSku(SysReturnSku sysReturnSku,SysReturnVO returnValue) throws Exception;
}

